package com.lzy.huijinjiazu.mvp.model;

import android.app.Application;
import android.support.v4.app.Fragment;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;

import javax.inject.Inject;

import com.lzy.huijinjiazu.R;
import com.lzy.huijinjiazu.mvp.contract.FinanceCollectContract;
import com.lzy.huijinjiazu.mvp.ui.fragment.CollectListFragment;
import com.lzy.huijinjiazu.mvp.ui.fragment.FinanceCollectListFragment;


@ActivityScope
public class FinanceCollectModel extends BaseModel implements FinanceCollectContract.Model {
    private Gson mGson;
    private Application mApplication;

    @Inject
    public FinanceCollectModel(IRepositoryManager repositoryManager, Gson gson, Application application) {
        super(repositoryManager);
        this.mGson = gson;
        this.mApplication = application;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }
    @Override
    public Fragment[] getTabFragment(String[] title) {
        Fragment fragment[] = new Fragment[title.length];
//       all：全部，pendingPayment：待付款,pendingDelivery:待发货，alreadyDelivered：已送货
        String[] strings = {"all", "pendingPayment", "pendingDelivery", "alreadyDelivered"};
        for (int i = 0; i < strings.length; i++) {
            fragment[i] = FinanceCollectListFragment.newInstance(strings[i]);
        }
        return fragment;
    }

    @Override
    public String[] getTitle() {
        return mApplication.getResources().getStringArray(R.array.collect_array_tab);
    }
}